package com.scs.application.modules.msg.service.impl;

import com.scs.application.core.service.BaseServiceImpl;
import com.scs.application.core.utils.UserUtils;
import com.scs.application.modules.msg.entity.InnerNotice;
import com.scs.application.modules.msg.mapper.InnerNoticeMapper;
import com.scs.application.modules.msg.service.InnerNoticeService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;


@Service
public class InnerNoticeServiceImpl extends BaseServiceImpl<InnerNoticeMapper, InnerNotice> implements InnerNoticeService {


    @Override
    public List<InnerNotice> listNews() {
        //一个月内
        LocalDateTime dateTime = LocalDateTime.now();
        dateTime = dateTime.minus(30, ChronoUnit.DAYS);
        System.out.println(dateTime.toString());
        List<InnerNotice> innerNoticeList = this.baseMapper.listNews(UserUtils.currentUser().getCode(),dateTime);
        return innerNoticeList;
    }

}
